<html xmlns:th="http://www.thymeleaf.org">
<head th:include="layout :: htmlhead" th:with="title='Hello'"></head>

<body>
<div class="container">

    <h4 class="float-left mt-2">增加股票</h4>

    <form class="form-inline" role="form" id="messageForm" th:action="@{/addShare}" method="post">
        <div class="form-group">
            <label for="shareCode" class="sr-only">股票代码</label>
            <div class="col-sm-10">
                <input id="shareCode" class="form-control" placeholder="请输入股票代码" type="text" th:name="shareCode">
            </div>
        </div>
        <div class="form-group">
            <label for="shareName" class="sr-only">股票名称</label>
            <div class="col-sm-10">
            <input id="shareName" class="form-control" placeholder="请输入股票名称" type="text" th:name="shareName">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default">Submit</button>
            </div>
        </div>
    </form>

    <div class="table-responsive">
    <table class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th>id</th>
                <th>股票代码</th>
                <th>股票名称</th>
                <th>添加日期</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="share,shareStat : ${shares.list}">
                <td th:text="${shareStat.index + 1}">id</td>
                <td th:text="${share.shareCode}">股票代碼</td>
                <td th:text="${share.shareName}">股票名称</td>
                <td th:text="${share.createDate}">添加日期</td>
                <td><a th:href="'/share/editShare?id=' + ${share.id}">修改</a>&nbsp;<a
                        th:href="'/share/delete?id=' + ${share.id}">删除</a>
                    <a th:href="'/share/viewShare?id=' + ${share.id}">详情</a>
                </td>
            </tr>
        </tbody>
    </table>
    </div>
    <table>
        <tr>
            <td align="right">
                <span>第<span th:text="${shares.currPage}"/>/<span th:text="${shares.totalPage}"/>页</span>
                <span>总记录数：<span th:text="${shares.totalCount}"/>/每页显示:<span th:text="${shares.pageSize}"/>条记录</span>
						<span>
							<a th:if="${shares.currPage ne 1}" th:href="'/share/listByPage'">[首页]</a>&nbsp;&nbsp;
							<a th:if="${shares.currPage ne 1}"
                               th:href="'/share/listByPage?currentPage=' + ${shares.currPage - 1}">[上一页]</a>&nbsp;&nbsp;
							<a th:if="${shares.currPage ne shares.totalPage}"
                               th:href="'/share/listByPage?currentPage=' + ${shares.currPage + 1}">[下一页]</a>&nbsp;&nbsp;
							<a th:if="${shares.currPage ne shares.totalPage}"
                               th:href="'/share/listByPage?currentPage=' + ${shares.totalPage}">[尾页]</a>&nbsp;&nbsp;
						</span>
            </td>
        </tr>
    </table>
</div>
</body>
</html>
